package com.axxc.jpa.pattendegign.filter;

import java.util.List;

/**
 * @ClassName OrCriteria
 * @Description //TODO Or
 * @author xxc
 * @data 2018年9月8日下午10:57:45
 * @see {@link http://gitee.com/biuabiu/ }
 */
public class OrCriteria implements CriteriaFilter {

	private CriteriaFilter thisCriteria;
	private CriteriaFilter otherCriteria;

	public OrCriteria(CriteriaFilter thisCriteria, CriteriaFilter otherCriteria) {
		super();
		this.thisCriteria = thisCriteria;
		this.otherCriteria = otherCriteria;
	}

	@Override
	public List<Person> doFiler(List<Person> personLists) {
		List<Person> thisLists = thisCriteria.doFiler(personLists);
		List<Person> otherLists = otherCriteria.doFiler(personLists);
		otherLists.forEach(e -> {
			if (!thisLists.contains(e)) {
				thisLists.add(e);
			}
		});
		return thisLists;
	}

}
